{literal}
<script src="http://www.google.com/jsapi" language="javascript"></script>
<script type="text/javascript">
function initialize() {
	this.lat = 0;
	this.lng = 0;
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("mapa-najblizszych-lokalizacji"));
		if (google.loader.ClientLocation && google.loader.ClientLocation.address.region) {
			this.lat = google.loader.ClientLocation.latitude;
			this.lng = google.loader.ClientLocation.longitude;
		    map.setCenter(new GLatLng(this.lat,this.lng), 9);
		    map.setUIToDefault();
		}else{
			var geocoder = new GClientGeocoder();
			geocoder.getLatLng("Ireland",	function( point ) {
				if (!point) {
					this.lat = 50;
					this.lng = -8;
				} else {					
					this.lat = point.lat();
					this.lng = point.lng();	
				}
			    map.setCenter(new GLatLng(this.lat,this.lng), 8);
			    map.setUIToDefault();
			});
		}
		GDownloadUrl("{/literal}{$smarty.const.HTTP_URL}{$page}{literal},KatalogTA,listaXMLLokalizacjiProduktowLatLng.html", function(data){
			xml = GXml.parse(data);
			markers  = xml.documentElement.getElementsByTagName("marker");
			addMarkers(markers, map);
		});
  }
}

function addMarkers(markers,map){
	
	for (var i = 0; i < markers.length; i++){
	    var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
	                            parseFloat(markers[i].getAttribute("lng")));
        var name = markers[i].getAttribute("name");
        var adress = markers[i].getAttribute("address");
        var url = "{/literal}{$settings_katalog_ta.mainpage|default:$page},,show_offert,"+markers[i].getAttribute("pID")+","+markers[i].getAttribute("cID")+".html";
        var foto = "<div class=\"thumbnail\" onclick=\"document.location='{$smarty.const.HTTP_URL}{$settings_katalog_ta.mainpage|default:$page},,show_offert,"+markers[i].getAttribute("pID")+","+markers[i].getAttribute("cID")+".html';\" style=\"background-image: url({$smarty.const.HTTP_URL}photo,/public/users/{$smarty.server.HTTP_HOST|replace:'www.':''}/KatalogTA/"+markers[i].getAttribute("pID")+"_logo.jpg,100,100,100.jpg); width: 100px; height: 100px; _height:100px;  background-repeat: no-repeat; float: left; padding: 2px; {literal}\"></div>";
		var marker = createMarker(point,name,adress,url,foto);
	   map.addOverlay(marker);
	}

}

function createMarker (point,name,adress,url,foto){
	var marker = new GMarker(point);
	var html_ = foto+"<h3><a href=\""+url+"\">"+name +"</a></h3><p><a href=\""+url+"\">"+adress+"</a></p>";
	GEvent.addListener(marker, 'click', function(){
		marker.openInfoWindowHtml(html_);
	});
	return marker;
}

$(document).ready(function(){
	initialize();
});
</script>
{/literal}
<div id="mapa-najblizszych-lokalizacji" style="width: 960px; height: 400px;"></div>